//
//  CZComposeViewController.swift
//  GZWeibo007
//
//  Created by shan on 15/12/24.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit


class CZComposeViewController: UIViewController ,CZStatusBottomViewDelegate{
    
    var status: CZStatus? {
        didSet {
            
            buttomView.forwardButton.setTitle("\(status!.reposts_count)", forState: UIControlState.Normal)
            buttomView.commentButton.setTitle("\(status!.comments_count)", forState: UIControlState.Normal)
            buttomView.zanButton.setTitle("\(status!.attitudes_count)", forState: UIControlState.Normal)
            let forwardStatus = status!.retweeted_status
            print("forwardStatus----\(forwardStatus)")
        }
    }

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        buttomView.delegate = self
        view.backgroundColor = UIColor.redColor()
        
        self.tabBarController?.tabBar.hidden = true
        
        prepareUI()
    }
    
    func modalForwardButtonClick() {
        let forWardVC = CZForwardViewController()
        let nav = UINavigationController(rootViewController: forWardVC)
        self.presentViewController(nav, animated: true, completion: nil)
    }
    func modalCommentButtomClick() {
        let commentVC = CZCommentController()
        let nav = UINavigationController(rootViewController: commentVC)
        self.presentViewController(nav, animated: true, completion: nil)
    }
    
    func prepareUI() {
        view.addSubview(buttomView)
        
        buttomView.ff_AlignInner(type: ff_AlignType.BottomCenter, referView: view, size: CGSize(width: UIScreen.mainScreen().bounds.width, height: 44))
        buttomView.commentButton.addTarget(self, action: "didClickConmentBtn", forControlEvents: UIControlEvents.TouchUpInside)
        
    }
    
    // 转发按钮点击事件
    //评论点击
    func didClickConmentBtn(){
        let commentVC = CZCommentController()
         presentViewController(UINavigationController(rootViewController: commentVC), animated: true, completion: nil)
        
        print("点击了评论")
    }
    
    //MARK: - 懒加载
    lazy var buttomView: CZStatusBottomView = CZStatusBottomView()
    
    

}


